<template>
	<view class="container">
		<view class="nav-bar">
			<image class="bar-bg-img" src="../../static/images/index/bg.png"></image>
			<view class="sys-name">网络联盟宽带管理平台</view>
			<view class="cur-date">{{current}}</view>
		</view>
		<view class="funcs"> 
			<view class="item"  v-for="(item, index) in funcs" :key="index" @click="gotoFunc(item)">
				<image :src="item.icon" class="item-icon"></image>
				<view class="item-text">{{item.name}}</view>
			</view>
		</view><!--funcs end-->
		<view class="record">
			<view class="re-top">
				<view class="rt-left"><text class="rtl-title">当前申请</text></view>
				<view class="rt-right">
					<!-- 更多<image class="arrow-right" src="../../static/images/me/arrow.png"></image> -->
				</view>
			</view>
			<view class="re-content">
				<view class="list" v-for="x in 1">
					<view class="l-item" v-for="n in datas" @click="gotoDetail(n)">
						<view class="top-bg">
							<text class="dept">申请时间：{{n.created_time}}</text>
							<text class="status" v-if="n.status == 0">审核中</text>
						</view>
						<view class="content">
							<view class="c-left">
								<image class="avatar" src="../../static/images/kd.png"></image>
							</view>
							<view class="c-right">
								<view class="cr-top">
									<view class="name">{{n.name}}</view>
									<view class="title">{{n.address}}</view>
									<view class="title">{{n.phone}}</view>
								</view>
								<view class="cr-bottom">
									加入时间：{{n.join_time}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view><!--record end-->
		
	</view>
</template>

<script>
	import {user_brand_requesting_list} from "@/api/platform.js";
	import {login} from "@/api/user";
	export default {
		data() {
			return {
				funcs:[
					{'name':'提交申请','url':'/pages/request/index','icon':'../../static/images/index/func01.png'},
					{'name':'我的申请','url':'/pages/request/list','icon':'../../static/images/index/func02.png'},
					{'name':'我的宽带','url':'/pages/broad/list','icon':'../../static/images/index/func03.png'},
					// {'name':'历史请假','url':'','icon':'../../static/images/index/func04.png'},
				],
				current:'',
				datas:[]
			}
		},
		components: {
			
		},
		onLoad() {
			let that = this;
			//日期
			//获取当前年月日
			var now = new Date();
			var year = now.getFullYear(); //得到年份
			var month = now.getMonth()+1;//得到月份
			var date = now.getDate();//得到日期
			var current = year + "年" + month + "月" + date + "日" ;
			var weekDay = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];

			that.current = current +" "+weekDay[now.getDay()];
			
			this.index(); 
		},
		onShareAppMessage(){
			
		},
		methods: {
			gotoFunc(item){
				uni.navigateTo({
					url:item.url
				})
			},
			gotoDetail(n){
				uni.navigateTo({
					url:'/pages/broad/detail?created_time='+n.created_time+'&name='+n.name+"&address="+n.address+"&phone="+n.phone+"&status="+n.status+"&reason="+n.reason+"&join_time="+n.join_time+"&audi_time="+n.audi_time+"&start_time="+n.start_time+"&end_time="+n.end_time
				})
			},
			index(){
				let that = this;
				uni.showLoading({
					title:"加载中..."
				});
				user_brand_requesting_list({}).then((res)=>{
					uni.hideLoading(); 
					that.datas = res.data.list;
				}).catch((error)=>{
					uni.hideLoading();
					console.log(error);
				});
			}
		}//end methods
	}
</script>

<style  scoped lang="scss">
	.container {
		display: flex;
		flex-direction: column;
		padding-bottom: 0;
		padding-bottom: constant(safe-area-inset-bottom);  
		padding-bottom: env(safe-area-inset-bottom); 
	}
	
	.nav-bar{
		height: 340rpx;
		
		.bar-bg-img{
			display: flex;
			flex-direction: column;
			width: 100%;
			height:424rpx;
		}
		.sys-name{
			margin-top: -290rpx;
			font-weight: bold;
			font-size: 52rpx;
			color: #FFFFFF;
			margin-left: 36rpx;
		}
		.cur-date{
			font-weight: bold;
			font-size: 28rpx;
			color: #FFFFFF;
			margin-left: 36rpx;
		}
	}
	.funcs{
		height: 292rpx;
		margin-left: 36rpx;
		margin-right: 36rpx;
		background-color: #FFFFFF;
		border-radius: 12rpx;
		box-shadow: 0px 3px 6px 2px rgba(0, 0, 0, 0.1);
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		padding: 0px 20rpx;
		
		.item{
			width:33.3%;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			
			.item-icon{
				width:110rpx;
				height:110rpx;
			}
			
			.item-text{
				font-size: 28rpx;
				margin-top: 20rpx;
			}
		}
	}
	.record{
		display: flex;
		flex-direction: column;
		margin-left: 36rpx;
		margin-right: 36rpx;
		margin-top: 20rpx;
		
		.re-top{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			margin-top: 20rpx;
			margin-bottom: 20rpx;
			
			.rt-left{
				.rtl-title{
					font-size: 30rpx;
					// font-weight: bold;
				}
				.rtl-price{
					font-size: 30rpx;
					color: #FF0000;
					font-weight: bold;
				}
			}
			
			.rt-right{
				display: flex;
				flex-direction: row;
				align-items: center;
				
				font-size: 28rpx;
				
				.arrow-right{
					width:28rpx;
					height:28rpx;
				}
			}
		}
		.re-content{
			display: flex;
			flex-direction: column;
			
			.list{
				display: flex;
				flex-direction: column;
				// padding: 0rpx 20rpx 20rpx 0rpx;
			}
			.dept_name{
				font-size: 32rpx;
				font-weight: bold;
			}
			.l-item{
				background-color: #FFFFFF;
				border-radius: 12rpx;
				display: flex;
				flex-direction: column;
				padding: 20rpx;
				margin-bottom: 20rpx;
				box-shadow: 0px 3px 6px 2px rgba(0, 0, 0, 0.05);
				.top-bg{
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					border-bottom: 1rpx solid #F0F0F0;
					padding-bottom: 20rpx;
					.dept{
						font-size: 28rpx;
						font-weight: bold;
						color: #808080;
					}
					.status{
						font-size: 26rpx;
						// background-color: #366092;
						color: #606266;
						width: 80rpx;
						height: 40rpx;
						text-align: center;
						line-height: 40rpx;
						border-radius: 20rpx;
					}
				}
				.content{
					display: flex;
					flex-direction: row;
					margin-top: 20rpx;
					.c-left{
						
						.avatar{
							width: 120rpx;
							height:120rpx;
							border-radius: 12rpx;
						}
					}
					.c-right{
						margin-left: 20rpx;
						display: flex;
						flex-direction: column;
						justify-content: space-between;
						
						.cr-top{
							.name{
								font-size: 28rpx;
								font-weight: bold;
							}
							.title{
								font-size: 26rpx;
								color: #3d3d3d;
								margin-top: 5rpx;
							} 
						}
						.cr-bottom{
							margin-top: 20rpx;
							font-size: 24rpx;
							color: #8F939C;
						}
					}
				}
			}
		}//.re-content end
	}
	.bottom20{
		margin-bottom: 20rpx;
	}
</style>
